﻿<!--File Info Header
________________________________________________________________________________________

  Copyright (C) 2011 Jason Zhang, eagleboost@msn.com

  * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
  * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

________________________________________________________________________________________*/
-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:control="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown"
                    xmlns:converters="clr-namespace:EagleBoost.Wpf.Presentation.Converters">

  <Style TargetType="{x:Type control:NumericUpDown}" x:Key="NumericUpDown">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type control:NumericUpDown}">
          <Grid MaxHeight="22">
            <Grid.RowDefinitions>
              <RowDefinition Height="22"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBox Grid.ColumnSpan="2" x:Name="PART_TextBox" VerticalContentAlignment="Center"
                     TextAlignment="{Binding Path=ValueAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
            <ScrollBar Grid.Column="1" x:Name="PART_ScrollBar" Margin="2" Focusable="False"
                       Maximum="{Binding Path=Minimum, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Converter={converters:NegativeConverter}}"
                       Minimum="{Binding Path=Maximum, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Converter={converters:NegativeConverter}}"
                       LargeChange="{Binding Path=LargeChange, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                       SmallChange="{Binding Path=SmallChange, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                       Value="{Binding Path=Value, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Converter={converters:NegativeConverter}}"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>